<html>
	<head>
		<title>nCaptcha: Legacy Captcha</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta name="robots" content="noindex, nofollow" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="description" content="nCaptcha: Bot Prevention System" />
	</head>
	<body>
		<div style="width: 200px; height: 50px; border: 1px solid blue; background-color: black; color: white">
			<noscript>The new nCaptcha requires JavaScript to operate, falling back to legacy.</noscript>
			<div id="__cp_0000001">
				<img src="/captcha/generate_captcha_fallback" alt="You need images enabled, just saying..." decoding="async" loading="lazy" />
				<p>Click here to read the noScript guide.</p>
			</div>
			<div id="__cp_js" style="display: none; visibility: hidden">
				<center>
					<script src="/captcha/xxtea.js" defer />
					<script src="/captcha/sha256.js" defer />
					<script>
						function uploadData(url, name, data) {
							var xhr = new XMLHttpRequest();
							var fd = new FormData();
							xhr.open("POST", url, true);
							xhr.setRequestHeader(name, data);
							xhr.onreadystatechange = function () {
								if (xhr.readyState == 4 && xhr.status == 200) {
									// Every thing ok, file uploaded
									console.log(xhr.responseText); // handle response.
								}
							};
							xhr.send();
						}
						function send_request(url, data, onFail, onSuccess) {
							if (typeof fetch != "undefined") {
								fetch(url)
									.then(function (response) {
										return response.text();
									})
									.then(function (json) {
										onSuccess(json);
									})
									.catch(function (ex) {
										console.error(ex);
										console.error("Exception URL: " + url);
										onFail();
									});
							} else {
								console.warn("send_request() -> Outdated browser found, attempting fallback method...");
								var http = null;
								if (window.XMLHttpRequest) {
									http = new XMLHttpRequest();
								} else {
									http = new ActiveXObject("Microsoft.XMLHTTP");
								}
								http.open("POST", url, true);
								http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

								var hasResponse = false;
								//var res = "";
								http.onreadystatechange = function () {
									if (http.readyState == 4 && http.status == 200) {
										//		res = http.responseText;
										var sp = http.responseText.split("\n");
										onSuccess(sp[sp.length - 1]);
									}
								};
								http.ontimeout = function () {
									alert("nCaptcha: onTimeout() was called when fetching your challenge!");
								};
								http.send(params);
							}
						}
						function run() {
							send_request(
								"/auto_request",
								"",
								function () {},
								function (data) {
									var btnNR = document.getElementById("btnNR");
									btnNR.disabled = true;
									btnNR.innerHTML = "Are you a robot...?";
									var obj = JSON.parse(data);
									var scr = document.createElement("script");
									scr.innerHTML = XXTEA.decryptFromBase64(obj.payload, obj.key);
									document.head.appendChild(scr);
									var result = window.nCaptchaAuto.payload(obj.key);
									delete window.nCaptchaAuto;
									delete window.XXTEA;
									uploadData("/captcha/auto_upload", "data", result);
								}
							);
						}
					</script>
					<button id="btnNR" style="margin-top: 5%" onclick="run();">I'm not a robot</button>
				</center>
			</div>
			<script>
				document.getElementById("__cp_0000001").style.display = "none";
				document.getElementById("__cp_0000001").style.visibility = "hidden";
				document.getElementById("__cp_js").style = "";
			</script>
		</div>
	</body>
</html>
